let events = require("events");

let eventEmitter = new events.EventEmitter();

// 监听hello事件
eventEmitter.on("hello", (...o) => {

    console.log(o)
    console.log("hello 事件监听 1");
})

//重复监听
eventEmitter.addListener("hello", (...o) => {
    console.log(o)
    console.log("hello 事件监听 2");
})

//获取监听数量
eventEmitter.listenerCount("e")

console.log("触发事件 hello")
eventEmitter.emit("hello")
eventEmitter.emit("hello",1,2)

